﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Net.Http;
using System.Text;
using System.Threading.Tasks;
using Microsoft.Extensions.Logging;

namespace Nlog.Framework.Log
{
    public class NLogHelper : INLogHelper
    {
        //public static Logger logger { get; private set; }

        private readonly HttpContent _httpContextAccessor;

        private readonly ILogger<NLogHelper> _logger;

        public NLogHelper(HttpContent httpContextAccessor, ILogger<NLogHelper> logger)
        {
            _httpContextAccessor = httpContextAccessor;
            _logger = logger;
        }

        public void LogError(Exception ex)
        {
            throw new NotImplementedException();
        }

        //public void LogError(Exception ex)
        //{
        //    LogMessage logMessage = new LogMessage();
        //    logMessage.IpAddress = _httpContextAccessor;
        //    if (ex.InnerException != null)
        //        logMessage.LogInfo = ex.InnerException.Message;
        //    else
        //        logMessage.LogInfo = ex.Message;
        //    logMessage.StackTrace = ex.StackTrace;
        //    logMessage.OperationTime = DateTime.Now;
        //    logMessage.OperationName = "admin";
        //    _logger.LogError(LogFormat.ErrorFormat(logMessage));
        //}
    }
}
